package com.example.click.huanxin;

import android.os.Bundle;
import android.os.SystemClock;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;


import com.example.click.huanxin.entity.User;
import com.example.click.huanxin.ui.BaseActivity;
import com.example.click.mvpfoot.R;

import cn.bmob.v3.Bmob;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

public class MainActivity extends BaseActivity {

    private Button button;@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button = (Button) findViewById(R.id.buttonPanel);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        Bmob.initialize(this, "1f7eae0ac4283c602715d91525a5870f");
        SystemClock.sleep(500);
        User user=new User();
        user.setName("cql");
        user.save(new SaveListener<String>() {
            @Override
            public void done(String s, BmobException e) {
                if (e==null){
                    Toast.makeText(MainActivity.this,"添加成功", Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(MainActivity.this,"添加失败", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
